#include "../H/Transmission.h"

//------------------------------------------------------------------------------
// METHOD:  Transmission::Transmission()
// Type:	Constructor
//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
Transmission::Transmission()
{
	static const UINT8  SOLENOID_BREAKOUT_MODULE = 1;
	static const UINT32 FORWARD_CHANNEL          = 3;
	static const UINT32 REVERSE_CHANNEL          = 4;

	pGear = new DoubleSolenoid(SOLENOID_BREAKOUT_MODULE,FORWARD_CHANNEL
			                                           ,REVERSE_CHANNEL);

	ShiftLow();
}
//------------------------------------------------------------------------------
// METHOD:  Transmission::Transmission()
// Type:	Constructor
//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
Transmission::Transmission(UINT32 forwardChannel, UINT32 reverseChannel)
{
	static const UINT8 SOLENOID_BREAKOUT_MODULE = 1;

	pGear = new DoubleSolenoid(SOLENOID_BREAKOUT_MODULE,forwardChannel
			                                           ,reverseChannel);

	ShiftLow();
}
//------------------------------------------------------------------------------
// METHOD:  Transmission::Transmission()
// Type:	Constructor
//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
Transmission::Transmission(UINT8 moduleNumber, UINT32 forwardChannel
		                                     , UINT32 reverseChannel)
{
	pGear = new DoubleSolenoid(moduleNumber,forwardChannel,reverseChannel);

	ShiftLow();
}
//------------------------------------------------------------------------------
// METHOD:  Transmission::~Transmission()
// Type:	Destructor
//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
Transmission::~Transmission()
{
	// Does nothing
}
//------------------------------------------------------------------------------
// METHOD:  Transmission::ShiftHigh()
// Type:	Method
//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
void  Transmission::ShiftGear(int gearSpeed)
{
	if(gearSpeed == kHighSpeed)
		ShiftHigh();
	else if(gearSpeed == kLowSpeed)
		ShiftLow();

	return;
}
//------------------------------------------------------------------------------
// METHOD:  Transmission::ShiftHigh()
// Type:	Method
//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
void  Transmission::ShiftHigh()
{
	pGear->Set(DoubleSolenoid::kForward);

	gearStatus = kHighSpeed;

	return;
}
//------------------------------------------------------------------------------
// METHOD:  Transmission::ShiftLow()
// Type:	Constructor
//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
void  Transmission::ShiftLow()
{
	pGear->Set(DoubleSolenoid::kReverse);

	gearStatus = kLowSpeed;

	return;
}
//------------------------------------------------------------------------------
// METHOD:  Transmission::GetGear()
// Type:	Constructor
//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
int   Transmission::GetGear()
{
	return gearStatus;
}
